//
//  QSTask.h
//  QSMusicPillow
//
//  Created by user on 2022/5/11.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface QSTask : NSOperation

@property (nonatomic, strong) NSError *error;

/**
 *  create task with block.
 */
+ (instancetype)taskWithBlock:(NSError *(^)(QSTask *task))block;

/**
 *  require override, do the real job in this method, when finish, should call `finishWithError:`
 */
- (void)executeTask;

/**
 *  call this method when task is finished, if error is nil, consider it successed.
 */
- (void)finishWithError:(NSError *)error;

@end

NS_ASSUME_NONNULL_END
